package com.icode.core.model.manage;

import com.icode.core.model.AbstractEntity;
import com.icode.core.model.house.HouseInfo;
import com.icode.core.model.house.HouseWeek;
import com.icode.core.model.user.UserInfo;

import javax.persistence.*;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: xianfei
 * Date: 15-4-14
 * Time: 下午3:05
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "reserve")
public class Reserve extends AbstractEntity {

    @OneToOne
    @JoinColumn(name = "house_info_id")
    private HouseInfo houseInfo;
    @OneToOne
    @JoinColumn(name = "house_week_id")
    private HouseWeek houseWeek;
    @OneToOne
    @JoinColumn(name = "user_info_id")
    private UserInfo userInfo;
    private String occupancyName; //入住人姓名
    private String IDCard;
    private String phoneNum;
    private String email;
    private String gender;
    private String peers;
    private String remarks;
    private String status; //已入住，未入住
    private String buyNum; //购买的份数
    @OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "reserve_id")
    private List<ReserveTime> reserveTimes;
    private String date;

    public Reserve() {
    }

    public Reserve(String occupancyName, String IDCard, String phoneNum, String email, String gender, String peers, String remarks, String status, String buyNum, String date) {
        this.occupancyName = occupancyName;
        this.IDCard = IDCard;
        this.phoneNum = phoneNum;
        this.email = email;
        this.gender = gender;
        this.peers = peers;
        this.remarks = remarks;
        this.status = status;
        this.buyNum = buyNum;
        this.date = date;
    }

    public Reserve(String occupancyName, String IDCard, String phoneNum, String email, String peers, String remarks, String status, String buyNum, String date) {
        this.occupancyName = occupancyName;
        this.IDCard = IDCard;
        this.phoneNum = phoneNum;
        this.email = email;
        this.peers = peers;
        this.remarks = remarks;
        this.status = status;
        this.buyNum = buyNum;
        this.date = date;
    }

    public void initReserve(HouseInfo houseInfo, HouseWeek houseWeek, UserInfo userInfo) {
        this.houseInfo = houseInfo;
        this.houseWeek = houseWeek;
        this.userInfo = userInfo;
    }

    public void initReserveTime(List<ReserveTime> reserveTimes) {
        this.reserveTimes = reserveTimes;
    }

    public List<ReserveTime> reserveTimes() {
        return reserveTimes;
    }

    public HouseInfo houseInfo() {
        return houseInfo;
    }

    public HouseWeek houseWeek() {
        return houseWeek;
    }

    public String buyNum() {
        return buyNum;
    }

    public String occupancyName() {
        return occupancyName;
    }

    public String gender() {
        return gender;
    }

    public UserInfo userInfo() {
        return userInfo;
    }

    public String status() {
        return status;
    }

    public String peers() {
        return peers;
    }

    public String remarks() {
        return remarks;
    }

    public String date() {
        return date;
    }

    public String iDCard() {
        return IDCard;
    }

    public String phoneNum() {
        return phoneNum;
    }

    public String email() {
        return email;
    }
}
